
export function notification(id, options) {
  chrome.notifications.create(id, options);
}

export function setStorage(obj, fn) {
  ////console.log('写入信息setStorage', obj);
  chrome.storage.local.set(obj, fn);
}

export function getStorage(key, fn) {
  return new Promise((resolve, reject) => {
    chrome.storage.local.get(key, (result) => {
      if (chrome.runtime.lastError) {
        reject(chrome.runtime.lastError);
      } else {
        resolve(result);
      }
    });
  });
}

export function sleep(seconds) {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve();
    }, seconds);
  });
}
